import type { ComponentsConfig, ComponentsConfigRaw } from '../../types'
import { filterCriteria, filterResultList } from './simples'
import { extendSchemas } from '@/components/cms/utils'
import advsConfig from './base/advs'

const basePath = 'template.videoFilter'
const config: ComponentsConfig = {
  title: '筛选条件组件设置',
  default: 'filterCriteria',
  components: extendSchemas<ComponentsConfigRaw>(
    {
      filterCriteria: filterCriteria({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          style: `${basePath}.content.condition.style`,
          background: `${basePath}.content.condition.background`,
          fill: `${basePath}.content.condition.fillColor`,
          border: {
            color: `${basePath}.content.condition.border.color`,
            width: `${basePath}.content.condition.border.width`,
            radius: `${basePath}.content.condition.border.radius`
          },
          text: {
            color: `${basePath}.content.condition.text.color`,
            selectedColor: `${basePath}.content.condition.text.selectedColor`
          }
        }
      }),
      filterResultList: filterResultList({
        pageFields: {
          background: `${basePath}.background`
        },
        fields: {
          background: `${basePath}.content.result.background`,
          layout: {
            style: `${basePath}.content.result.layout.style`,
            limit: `${basePath}.content.result.layout.limit`
          }
        }
      })
    },
    advsConfig(['playerBeforeAdv', 'playerPauseAdv'])
  )
}

export default config
